package com.jianxin.service;

import com.jianxin.spring.*;

@Component
@Scope
public class UserService implements BeanNameAware, InitializingBean, UserInterface {

    //模拟依赖注入
    @Autowired
    private OrderService orderService;

    private String beanName;

    public void test(){
        //原生方法
        System.out.println(orderService);
    }

    //模拟spring的aware回调
    @Override
    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    //模拟spring提供给程序员干预初始化的方法
    @Override
    public void afterPropertiesSet() {
        System.out.println("afterPropertiesSet");
    }
}
